<?php
session_start();
mysql_connect("localhost", "sapmenet_admin", "a1s2d3f4g5h6j7") or die ("Problem with datebase");
mysql_select_db("sapmenet_users"); 
echo"<link rel = 'stylesheet' type = 'text/css' href = 'friendshipsRequestsStyle.css'>";
$not=mysql_query("SELECT id, IDsnimka, IDpub, text FROM notifications WHERE userID={$_SESSION['JID']} ORDER BY id desc");
while ($result=mysql_fetch_array($not, MYSQL_NUM))
	{
		if ($result[1]!=-1)
		{
			echo "<div class = 'singleNotificationTab'><div id=".$result[1].">".$result[3]."</div><img style = 'margin-top:-20px' src='del.png' id=".$result[0]." class = 'deleteNotificationButton' title = 'Delete Notification'><div class = 'clear'></div></div>";
		}
		if ($result[2]!=-1)
		{
			echo "<div class = 'singleNotificationTab'><div id=".$result[2].">".$result[3]."</div><img style = 'margin-top:-20px' src='del.png' id=".$result[0]." class = 'deleteNotificationButton' title = 'Delete Notification'><div class = 'clear'></div></div>";
		}
		if ($result[1]==-1 && $result[2]==-1)
		{
			echo "<div class = 'singleNotificationTab'>".$result[3]."<img src='del.png' id=".$result[0]." class = 'deleteNotificationButton' title = 'Delete Notification'><div class = 'clear'></div></div>";
		}
	}
	echo"<script>
		$('.deleteNotificationButton').click(function()
		{
			$('.deleteNotificationButton').removeClass('focus');
			$(this).addClass('focus');
			var theId = $('.focus').attr('id');
			$.post('delNotification.php', {idNotification : theId}, function(data)
			{
				$('#newsDialogTitle').html('News');
				$('#newsDialogHeadless').load('notification.php');
			});
		});
		
		$('.snimka').click(function()
		{
			$('.snimka').removeClass('tralala');
			$(this).addClass('tralala');
			var theId = $('.tralala').attr('id');
			$.post('showNotificationPicture.php', {snID : theId}, function(data)
			{
				$('#mainFrame').html(data);
			});
		});
		
		$('.picture').click(function()
		{
			$('.picture').removeClass('tralala');
			$(this).addClass('tralala');
			var theId = $('.tralala').attr('id');
			$.post('showNotificationPicture.php', {snID : theId}, function(data)
			{
				$('#mainFrame').html(data);
			});
		});
		
		$('.publicationn').click(function()
		{
			$('.publicationn').removeClass('ihaha');
			$(this).addClass('ihaha');
			var theId = $('.ihaha').attr('id');
			$.post('showSingleNotificatedPublication.php', {snID : theId}, function(data)
			{
				$('#mainFrame').html(data);
			});
		});
	</script>";
?>
































